from itertools import combinations

# 数据字段
fields = [
    "fnd17_oxlcxspebq","fnd17_shsoutbs","fnd17_oxlcxspebq","fnd28_value_05191q","fnd17_oxlcxspebq","fnd28_value_05192q",
"fnd17_oxlcxspebq","fnd28_value_05301q","fnd17_oxlcxspebq","fnd28_value_05302","fnd17_pehigh","fnd17_pelow",
"fnd17_priceavg150day","fnd17_priceavg200day","fnd17_priceavg150day","fnd17_priceavg50day","fnd17_priceavg200day",
"fnd17_priceavg50day","fnd17_pxedra","fnd17_tbea","fnd17_pxedra","fnd28_newa3_value_18191a","fnd17_pxedra",
"fnd28_newa3_value_18198a","fnd17_pxedra","fnd28_value_02300a","fnd17_pxedra","fnd28_value_05302",
"fnd17_pxedra","mdl175_ebitda","fnd17_pxedra","mdl175_pain"
]

# 去掉重复字段
fields = list(set(fields))

# 生成字段组合
combinations_list = combinations(fields, 2)

# 生成Alpha表达式并输出
alpha_expressions = []
for comb in combinations_list:
    A, B = comb
    expression = f"ts_regression(ts_zscore({A}, 500), ts_zscore({B}, 500), 500)"
    alpha_expressions.append(expression)

# 输出总组合数和前几个Alpha表达式
print(f"Total combinations: {len(alpha_expressions)}")
print("Alpha表达式：")
for expr in alpha_expressions:
    print(expr)